<%@ page contentType="text/html;charset=UTF-8" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="form" uri="http://www.springframework.org/tags/form" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<c:set var="ctx" value="${pageContext.request.contextPath}"/>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=7" />
<link rel="stylesheet" href="${ctx}/static/css/style.css" type="text/css" /> 
<link rel="stylesheet" href="${ctx}/static/css/style1.css" type="text/css" /> 
<link rel="stylesheet" href="${ctx}/static/css/kongjian.css" type="text/css" /> 
<script src="${ctx}/static/script/jquery-1.4.min.js" type="text/javascript"></script>
<link rel="stylesheet" href="${ctx}/static/css/jquery.ui.all.css">
	<script src="${ctx}/static/script/jquery.ui.core.js"></script>
<script type="text/javascript" src="${ctx}/static/My97DatePicker/WdatePicker.js"></script>
<title>客户列表</title>
<script language="JavaScript">
	function jumpPage(pageNo) {
		$("#pageNo").val(pageNo);
		$("#mainForm").submit();
	}
	function confirmInvalid(itemId){
			 if(confirm("确认作废?"))
				{
					$.ajax({
					   type: "GET",
					   url: "${ctx}/crm/cancelCustomerInfo/"+itemId,
					   success: function(msg){
						   	if(msg.length>0){
							     alert( msg );
						   	}
						   	else{
						   		$("#mainForm").submit();
						   	}
					  	},
					  	error:function(msg){
					  	 alert("Oppps");
					  	}
					  }); 
				}
	}
	function doSubmit(){
		$("#pageNo").val(1);
	}
</script>
</head>

<body>
<form id="mainForm" action="${ctx}/crm/list" method="post" onSubmit="doSubmit();">
	<div class="er_banner">客户列表</div>
	   <div class="shenqing2">
			<table width="100%" border="0" cellspacing="0" cellpadding="0" >
	          <tr>
	            <td width="61">客户编号：</td>
	            <td width="150px" style="color:#2E74D1;"><input type="text" name="code" class="ggkj_inputtext_80" value="${customerListForm.code}" /></td>
	            <td width="85">客户姓名：</td>
	            <td width="150px" style="color:#2E74D1;"><input type="text" name="cnName" class="ggkj_inputtext_80" value="${customerListForm.cnName}" />
	            </td>
				<td width="85">手机号码：</td>
	            <td width="150px" style="color:#2E74D1;"><input type="text" name="mobile" class="ggkj_inputtext_80" value="${customerListForm.mobile}" />
	            </td>
				<td width="85">申请日期：</td>
	            <td width="250px" style="color:#2E74D1;"><input type="text" size="7" readonly="true" name="startDate" onClick="WdatePicker()" value="${customerListForm.startDate}"/>-<input type="text" size="7" readonly="true" name="endDate" onClick="WdatePicker()" value="${customerListForm.endDate}" />
	            </td>
				 <td width="93"><input name="Input" type="submit" class="chaxun_btn" value="&nbsp;&nbsp;查询" />
	             </td>
	          </tr>
	      </table>
	    </div>
	    <div clas="yiban" style="text-align:left;padding-left:3px;margin-top:10px;">
			<p><a href="${ctx}/crm/createCustomerForm" class="ggkj_btnNormal1" >
			<span class="ggkj_btnNormal_span"><input name="" type="button" value="新增客户 " class="ggkj_btnInner1" onclick="window.location=('${ctx}/crm/createCustomerForm');"/></span>
			</a>
			</p>
	  </div>
	  <c:if test="${not empty error}">
	<div style="color:red">
		${error}
	</div>
</c:if>
	  
	<div class="yiban">
		<table style="width:100%;" class="ggkj_table"  border="0" cellspacing="0" cellpadding="0">
	  <tr>
	    <th scope="col">序号</th>
	    <th scope="col">客户编号</th>
	    <th scope="col">客户姓名</th>
	    <th scope="col">手机号码</th>
	    <th scope="col">申请日期</th>
	    <th scope="col">操作</th>
	  </tr>
	  <c:forEach items="${page.result}" var="item" varStatus="index">
		  <c:if test="${index.count%2==1}"><tr class="ggkj_tdColr"></c:if>
		  <c:if test="${index.count%2!=1}"><tr></c:if>
		    <td>${index.count}</td>
		    <td height="34">${item.customerCode}</td>
		    <td><a href="${ctx}/crm/customerInfoDetail/${item.id}">${item.cnName}</a></td>
		    <td>${item.mobile}</td>
		    <td><fmt:formatDate value="${item.createDate}"/></td>
		    <td>
		    <c:if test="${item.customerCode=='000001'}">
			    <a href="${ctx}/crm/customer/${item.id}/bankInfo">银行卡</a>&nbsp;|投资&nbsp;<!-- |放款 -->|<a href="${ctx}/crm/updateCustomerForm/${item.id}">修改</a>|<a href="#" onclick="confirmInvalid(${item.id})">作废</a> </td>
		    </c:if>
		    <c:if test="${item.customerCode!='000001'}">
		    	<a href="${ctx}/crm/customer/${item.id}/bankInfo">银行卡</a>&nbsp;|<a href="${ctx}/fortune/invest_add_init/${item.id}">投资</a>&nbsp;<!-- |放款 -->|<a href="${ctx}/crm/updateCustomerForm/${item.id}">修改</a>|<a href="#" onclick="confirmInvalid(${item.id})">作废</a> </td>
		    </c:if>
		  </tr>
	  </c:forEach>
	</table>
		
	</div>
	<div class="ggkj_pagecontainer">
	  <div class="ggkj_pageBGleft">
	    	<span class="ggkj_pageBGright"></span>
	    	<a href="javascript:jumpPage(1)" class="ggkj_pageUpa">
	        
	        </a>
	        <a href="javascript:jumpPage(${page.prePage})" class="ggkj_pageUp">
	        
	        </a>
	        <span class="ggkj_insertline"></span>
	        <span class="ggkj_pageSpan">
	        	页<input type="text" id="pageNo" name="pageNo" class="ggkj_inputtext_30" value="${page.pageNo}">OF ${page.totalPages}
	        </span>
	        <span class="ggkj_insertline"></span>
	        <a href="javascript:queryPayback_nextPage()" class="ggkj_pageDown">
	        
	        </a>
	        <a href="javascript:jumpPage(${page.totalPages})" class="ggkj_pageDowna">
	        
	        </a>
	    </div>
	</div>
</form>
</body>
</html>
